package views.inventory;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import controller.AddNewSellerController;
import controller.PrintBarCodeController;
import controller.StockReportController;
import uiframework.UIFrameWork;
import java.awt.Font;
import java.awt.Dimension;

public class InventoryView extends JPanel implements MouseListener 
{
	private JToolBar toolBar;
	private SpringLayout springLayout;
		
	public InventoryView() 
	{
		springLayout = new SpringLayout();
		setLayout(springLayout);
		setSize(1050,550);

		toolBar=UIFrameWork.addToolBar(this, springLayout);
		String[] menunames={"Add New Seller","Add New Stock","Print Bar Code","Stock Report"};
		JLabel[]leftMenu=UIFrameWork.setLeftMenu(menunames,toolBar, new Dimension(180, 40));
	    Font font=new Font("MS Reference Sans Serif", Font.PLAIN, 13);
	    UIFrameWork.styleLeftMenu(leftMenu, font, null,null);
		setSize(900,550);
	}
	
	
	@Override
	public void mouseClicked(MouseEvent e) 
	{
		if(e.getSource() instanceof JLabel)
		{
			JLabel label=(JLabel) e.getSource();
			String labelTitle=label.getText();
			if(labelTitle.equals("Add New Seller"))
			{
				AddNewSeller view=new AddNewSeller();
				UIFrameWork.setFormComponent(springLayout, view,this,2);
				AddNewSellerController sellercontrl=new AddNewSellerController(view, null);
			}
				
			if(labelTitle.equals("Add NewS tock"))
			{
				AddNewStock view=new AddNewStock();
				UIFrameWork.setFormComponent(springLayout,  view,this,2);
				
			}
				
			if(labelTitle.equals("Print Bar Code"))
			{
				PrintBarCode view=new PrintBarCode();
				UIFrameWork.setReportComponent(springLayout,view,this,2);
				PrintBarCodeController barcodecon=new PrintBarCodeController(view);
			}
			if(labelTitle.equals("Stock Report"))
			{
				StockReport view=new StockReport();
				UIFrameWork.setReportComponent(springLayout, view,this,2);
				StockReportController stockcontrl=new StockReportController(view, null);
			}
		}
	}




	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}




	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}




	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}




	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	
	
	
}
